package com.zhuoyue.biz.core.command.cmd.common.faa.base;

import com.zhuoyue.biz.core.api.domain.DeviceAndGatewayDO;
import com.zhuoyue.biz.core.api.dto.req.ControlReq;
import com.zhuoyue.common.constant.ControlType;
import com.zhuoyue.common.constant.DataBase;
/**
 * @ClassName: BaseSetCmd
 * @Description:
 * @author wjming
 * @Date 2021-07-08 17:54
 */
public class BaseSetCmd extends SetCmd {
    private static Integer setRoad = null;

    /**
     * 场景配置
     *
     * @param deviceAndGatewayDO
     * @param controlReq
     * @param code4
     * @return
     */
    public static String set(DeviceAndGatewayDO deviceAndGatewayDO, ControlReq controlReq, String code4) {
        String cmd = "";
        switch (controlReq.getControlType()) {
            //场景配置
            case ControlType.Set.SCENE_SET_REQUEST:
                cmd = getControlCmd(deviceAndGatewayDO, sceneSet(code4));
                break;
            default:
                break;
        }
        return cmd;
    }

    private static String sceneSet(String code) {
        return setRoad < 10 ? 0 + "setRoad" : setRoad + "" + DataBase.DATA_LENGTH_12 + code + "0000000000000000000000000000000000";
    }
}
